package P1000;

import java.util.Scanner;

/**
 * @author: zhouyang
 * @descrpition:
 * @time: 2019-10-05 20:33
 */
public class P1089_津津的储蓄计划 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int left = 0,save = 0;
        for(int i=0;i<12;++i){
            int del = scanner.nextInt();
            left += 300;
            left -= del;
            if(left < 0){
                System.out.println(-i-1);
                return ;
            }
            save += left/100;
            left %= 100;
        }
        scanner.close();
        System.out.println(left+save*120);
    }
}
